#include <iostream>
using namespace std;
int main()
{
    int day;
    cin>>day;
    int afterTommorrow;
    afterTommorrow = (day + 2) % 7;
    if (afterTommorrow == 0 )
        afterTommorrow = 7;
    cout<<afterTommorrow;    
    
}